<layout name="Public/layout"/>
{:jumps($infos['authority'],CONTROLLER_NAME)}
        <script language="javascript" type="text/javascript">

            //显示选填的信息项
            function showOptionalInfo(imgObj) {
                var div = document.getElementById("optionalInfo");
                if (div.className == "hide") {
                    div.className = "show";
                    imgObj.src = "__PUBLIC__/images/hide.png";
                }
                else {
                    div.className = "hide";
                    imgObj.src = "__PUBLIC__/images/show.png";
                }
            }
        </script>

        
        <!--主要区域开始-->
        <div id="main">       
            
            <form action="__SELF__" method="post" class="main_form" id="formTest">
                
                <!--必填项-->
                <div class="text_info clearfix"><span>姓名：</span></div>
                <div class="input_info">
                    <input type="text" value="" maxlength="20" name="nickname"/>
                    <span class="required">*</span>
                    <div class="validate_msg_long">20长度以内的汉字、字母和数字的组合</div>
                </div>
                
                <div class="text_info clearfix"><span>职员编号：</span></div>
                <div class="input_info">
                    <input type="text" value="" maxlength="25" name="no"/>
                    <span class="required">*</span>
                    <div class="validate_msg_long">正确的职员编号格式</div>
                </div>
                
                <div class="text_info clearfix"><span>所属门店：</span></div>
                    <div class="input_info">
                        <select name="store_id">
                            <volist name="store" id="vo">
                                <option value="{$vo.id}">{$vo.name}</option>
                            </volist>
                        </select>  
                        
                        <input type="button" value="增加" class="btn_add" onclick="location.href='{:U('Store/add')}';" />
                        
                </div>                
                
                <div class="text_info clearfix"><span>登录账号：</span></div>
                <div class="input_info">
                    <input type="text" value=""  maxlength="30" name="username"/>
                    <span class="required">*</span>
                    <div class="validate_msg_long">16长度以内的字母、数字和下划线的组合</div>
                </div>
                <div class="text_info clearfix"><span>密码：</span></div>
                <div class="input_info">
                    <input type="password"  maxlength="30" name="password"/>
                    <span class="required">*</span>
                    <div class="validate_msg_long">16长度以内的字母、数字和下划线的组合</div>
                </div>
                
                <div class="text_info clearfix"><span>重复密码：</span></div>
                <div class="input_info">
                    <input type="password"  maxlength="30" name="confirm_password"/>
                    <span class="required">*</span>
                    <div class="validate_msg_long">两次密码必须相同</div>
                </div>               
                
                <!--可选项-->
                <div class="text_info clearfix"><span>可选项：</span></div>
                <div class="input_info">
                    <img src="__PUBLIC__/images/show.png" alt="展开" onclick="showOptionalInfo(this);" />
                </div>
                <div id="optionalInfo" class="hide">

                    <div class="text_info clearfix"><span>Email：</span></div>
                    <div class="input_info">
                        <input type="text" class="width350" name="email"/>
                        <div class="validate_msg_tiny">50长度以内，合法的 Email 格式</div>
                    </div> 
                    
                    <div class="text_info clearfix"><span>职业：</span></div>
                    <div class="input_info">
                        <select name="position">
                            <volist name="position" id="vo">
                                <option value="{$vo.id}">{$vo.name}</option>
                            </volist>
                        </select>  
                        
                        <input type="button" value="增加" class="btn_add" onclick="location.href='{:U('Position/add')}';" />
                        
                    </div>
                    
                <div class="text_info clearfix"><span>电话：</span></div>
                <div class="input_info">
                    <input type="text" class="width200" maxlength="20" name="tel"/>
                    <span class="required">*</span>
                    <div class="validate_msg_medium">正确的电话号码格式：手机或固话</div>
                </div>                      
                    
                    
                    <div class="text_info clearfix"><span>性别：</span></div>
                    <div class="input_info fee_type">
                        <input type="radio" name="sex" id="male" value="男" checked="checked"/>
                        <label for="male">男</label>
                        <input type="radio" name="sex" id="female" value="女"/>
                        <label for="female">女</label>
                    </div> 
                    <div class="text_info clearfix"><span>通信地址：</span></div>
                    <div class="input_info">
                        <input type="text" class="width350" name="address"/>
                        <div class="validate_msg_tiny">50长度以内</div>
                    </div> 
                    <div class="text_info clearfix"><span>邮编：</span></div>
                    <div class="input_info">
                        <input type="text" name="post"/>
                        <div class="validate_msg_long">6位数字</div>
                    </div> 
                    <div class="text_info clearfix"><span>QQ：</span></div>
                    <div class="input_info">
                        <input type="text" name="qq"/>
                        <div class="validate_msg_long">5到11位数字</div>
                    </div>                
                </div>
                
                <!--操作按钮-->
                <div class="button_info clearfix">
                    <input type="button" value="保存" class="btn_save" onclick="send(this)" />
                    <input type="reset" value="取消" class="btn_save" />
                </div>
                
            </form>  
        </div>
        <!--主要区域结束-->
        

<script>

//ajax提交
function send(obj){

            $.ajax({
                url: '__SELF__',
                type: 'post',
                dataType:'json',
                data: $("#formTest").serializeArray(),
                success: function(data) {
//                    console.log(data);
                    //判断是否添加成功！
                    if(data.status==0){
                        layer.msg(data.info,{icon: 5});
                    }else{
                        layer.msg(data.info,{icon: 6});
                        
                        //延迟跳转
                        setTimeout(function () {
                            location.href = "{:U('Account/index')}";
                        }, {:C('AJAX_TIME')});
                        
                        
                    }
                    
                }
            });
            

}

</script>        
<script type="text/javascript">
    $(function(){
        //点击之后的图标
        $('.emp_off').addClass('emp_on').removeClass('emp_off');
    });  
</script>